|
The interface-segregation principle (ISP) states that no client should be forced to depend on methods it does not use.〔 Martin, Robert (2002). Agile Software Development: Principles, Patterns and Practices. Pearson Education.〕 ISP splits interfaces which are very large into smaller and more specific ones so that clients will only have to know about the methods that are of interest to them. Such shrunken interfaces are also called ''role interface''s.〔(Role Interface )〕 ISP is intended to keep a system decoupled and thus easier to refactor, change, and redeploy. ISP is one of the five SOLID principles of Object-Oriented Design, similar to the High Cohesion Principle of GRASP.〔(David Hayden, ''Interface-Segregation Principle (ISP) - Principles of Object-Oriented Class Design'' )〕 ==Importance in object-oriented design== Within object-oriented design, interfaces provide layers of abstraction that facilitate conceptual explanation of the code and create a barrier preventing dependencies. According to many software experts who have signed the Manifesto for Software Craftsmanship, writing well-crafted and self-explanatory software is almost as important as writing working software.〔(Manifesto of Software Craftsmanship )〕 Using interfaces to further describe the intent of the software is often a good idea. A system may become so coupled at multiple levels that it is no longer possible to make a change in one place without necessitating many additional changes.〔 Using an interface or an abstract class can prevent this side effect. 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Interface segregation principle」の詳細全文を読む スポンサード リンク
|